using MinimalistFoodStreet.BackEnd.Infrastructure.EFCore;
using MinimalistFoodStreet.BackEnd.Infrastructure.Dtos.Response.Tables;
using MinimalistFoodStreet.BackEnd.Infrastructure.Tools;

namespace MinimalistFoodStreet.BackEnd.Server.Server.ResponseExtend.Tables
{
    public static class BusinesssEnitityExtend
    {
        public static ResponseBusinesssDto ToResponseDto(this Businesss entity, Account account)
        {
            return new ResponseBusinesssDto()
            {

                id = entity.BId,
                accountId = entity.BAccountId,
                openId = entity.BOpenId,
                name2 = entity.BName,
                managerName = entity.BManagerName,
                createTime = entity.BCreateTime,
                createTimeStr = Tools.TimeToString(entity.BCreateTime),
                updateTime = entity.BUpdateTime,
                updateTimeStr = Tools.TimeToString(entity.BUpdateTime),
                name = account.AName,
                account = account.AAccount,
                avatar = account.AAvatar,
                email = account.AEmail,
                endpoint = account.AEndpoint,
                isActive = account.AIsActive,
                isBan = account.AIsBan,
                phone = account.APhone,
            };
        }
    }
}